import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import eslintPluginVue from "eslint-plugin-vue";
import eslintConfigPrettier from "eslint-config-prettier";

/** @type {import('eslint').Linter.Config[]} */
export default [
  {
    ignores: [
      "**/*.d.ts",
      "**/coverage",
      "**/dist",
      ".prettierrc.ts",
      "commitlint.config.ts",
    ],
  },
  { files: ["**/*.{ts,tpl}"] },
  { languageOptions: { globals: globals.browser } },
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  ...eslintPluginVue.configs["flat/essential"],
  { 
    files: ["**/*.vue" ,"**/*.ts"], 
    languageOptions: { parserOptions: { parser: tseslint.parser } },
    rules: {
      "vue/multi-word-component-names": "off", // 关闭组件名必须多词的规则
      "@typescript-eslint/no-unused-vars": "warn", // 关闭未使用变量的规则
      "@typescript-eslint/no-explicit-any": "off", // 关闭禁止使用any类型的规则
    }
  },
  eslintConfigPrettier
]